    <%@ page contentType="text/html;charset=UTF-8" language="java" %>
        <%@include file="../common.jsp"%>

        <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户信息列表</title>
    <!-- load css -->
    <link rel="stylesheet" type="text/css" href="${ctx}common/frame/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}common/css/gobal.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}backstage/css/common.css" media="all">
    <link rel="stylesheet" type="text/css" href="${ctx}backstage/css/flink.css" media="all">
     <style type="text/css">
    .layui-icon{
        margin-top: 12px;
    }
    .layui-table-view{
    width:99.9% !important;
    }
    </style>
</head>
</head>
<body>
<div class="layui-fluid larry-wrapper">
    <blockquote class="layui-elem-quote larry-btn" style="height: 36px;">
        <a class="layui-btn layui-btn-radius" style="float: right;" id="add" lay-event="add">添加菜单</a>
    </blockquote>
    
    <div class="flinkTable">
        <table class="layui-table"   style="  "  id="bannerPage" lay-filter="bannerPage"></table>
    </div>


</div>
 <!-- <a class="layui-btn layui-btn-mini layui-btn-radius layui-btn-warm" lay-event="tixian">提现记录</a> -->
<script type="text/html" id="merchantBar">
	
    <a class="layui-btn layui-btn-mini layui-btn-radius layui-btn-normal" lay-event="edit">编辑</a>
    <a class="layui-btn layui-btn-mini layui-btn-radius layui-btn-danger" lay-event="del">删除</a>

</script>

<script type="text/html" id="urlvalue">
    {{#  if(d.type === 'view'){ }}
   	   {{d.lianjie}}
    {{#  } else { }}
            {{d.url}}
    {{#  } }}
</script>

<script type="text/html" id="type">
    {{#  if(d.type === 'view'){ }}
   	   链接
    {{#  } else { }}
           点击
    {{#  } }}
</script>

<script type="text/javascript" src="${ctx}common/frame/layui/layui.js"></script>

<script>
    layui.config({
        base: "${ctx}common/larrylib/",
        version: '201708031'
    }).use(["layer", "form", "table", "jquery", "laydate", "upload"], function () {
        var $ = layui.jquery;
        var e = layui.$, t = layui.layer, i = layui.form, l = layui.table;
        var width = $(document).width();
        var height = $(document).height();
		var id = ${submenu_pid};
        
      var a = l.render({
            elem: "#bannerPage",
            width: width,
            height: 'full-140',
            id: 'mytable',
            size: 'lg',
            cols: [[
                {field: 'title', title: '图文标题', align: "center", width: width * 0.11},
                {field: 'name', title: '标题', align: "center", width: width * 0.11},
                {field: 'keyvalue', title: '图文编码', align: "center", width: width * 0.2},
                {title: "类型", templet: "#type",align: "center", width: width * 0.08},
                //{field: 'url', title: '跳转地址', align: "center", width: width * 0.35},
                {title: "跳转地址", templet: "#urlvalue",align: "center", width: width * 0.31},
                {title: "常用操作", width: width * 0.15, align: "center", toolbar: "#merchantBar", fixed: "right"}
            ]],
            request: {
            	  pageName: 'pageCurrent',
            	  limitName: 'pageSize'
            	},   
            response: {
                statusName: 'state' //数据状态的字段名称，默认：code
                , statusCode: 'true' //成功的状态码，默认：0
                , msgName: 'msg' //状态信息的字段名称，默认：msg
                , countName: 'totalRow' //数据总数的字段名称，默认：count
                , dataName: 'list' //数据列表的字段名称，默认：data
            },
            url: "${ctx}menu/getchildepage?menuId="+id,
            page: true,
            limit: 10,
            even: true
        });
      
      l.on("tool(bannerPage)", function (e) {
    	  var i = e.data;
    	  var submenu_id = i.submenu_id;
    	  var submenu_pid = i.submenu_pid;
            //编辑菜单
            if (e.event == "edit") {
            	var e = layui.layer.open({
                    title: "编辑菜单信息",
                    type: 2,
                    move: false,
                    anim: 1,
                    skin: "larry-green",
                    offset: '100px',
                    area: [width / 2 + "px", height*0.72  + "px"],//toupdatechilde?submenu_id=${r.submenu_id}&submenu_pid=${r.submenu_pid}
                    content: "${ctx}menu/toupdatechilde?submenu_id="+submenu_id+"&submenu_pid="+submenu_pid
                    		
                });
            }
            
            if (e.event == "del") {
                t.confirm("该菜单数据将被清除,确认吗？", {
                    icon: 3,
                    skin: 'larry-green',
                    title: "删除提示",
                    offset: '200px',
                    closeBtn: 0,
                    skin: 'layui-layer-molv',
                    anim: Math.ceil(Math.random() * 6),
                    btn: ['确定', '取消']
                }, function (index) {
                    $.ajax({
                        url: '${ctx}menu/delchilde',
                        type: 'post',
                        async: false,
                        data: {submenu_id:i.submenu_id},
                        dataType: "json",
                        success: function (data) {
                            if (data.state == 'true') {
                                t.msg(data.res, {icon: 6});
                                a.reload();
                                return true;
                            } else {
                                t.msg(data.res, {icon: 5});
                                return false;
                            }
                            top.layer.close(loginLoading);
                        }, error: function () {
                            top.layer.msg("系统数据处理异常！", {icon: 2});
                            t.close(loginLoading);
                            return false;
                        }
                    });
                    layer.close(index);
                }, function (index) {

                    layer.close(index);
                });
            }
            
           
            
      }); 


	    e("#add").on("click", function () {
	   	 var e = layui.layer.open({
	            title: "添加菜单信息",
	            type: 2,
                move: false,
                anim: 1,
                skin: "larry-green",
                offset: '100px',
                area: [width / 2 + "px", height*0.72  + "px"],
                content: "${ctx}menu/toupdatechilde?submenu_pid="+id
	        });
	   });
	    

	        
    });
       


</script>


</body>
</html>